#include <stdio.h>
#include <stdlib.h>
//including string library
#include <string.h>
//include the zero header file
#include "zero.h"

/*Enter your functions on this page. Add more libraries if you
  have to, I added the string library for my functions.
*/


//1.	Function to find number of Rows
int number_of_rows(FILE *fp)
{
    //Declaring variables
    int i, num;
    char read[100], amount[15];
    char *ptr;

    //Information needed is on the 4th line of the document
    //This extracts the information on the 4th line and saves it to a char array
    for(i=0; i<4; i++)
	    {
	        fgets(read, 100, fp);
	    }

	//Reads from the array tokens until it reaches the information regarding the rows
	ptr = strtok(read," ");
    ptr = strtok(NULL," ");
    ptr = strtok(NULL," ");

    //Copying the information regarding rows to a char array
    strcpy(amount,ptr);

    //Converting Char array to an int
    num=atoi(amount);

    //Returning the number of Rows
    return num;

}


//2.	Function to allocate fill the array




//3.	Function to count zero crossings
int counter(int num, float *ptr)
{
    //variable declaration
    int i, count = 0;

    //loop to control counting of 0 crossings
    for(i = 0; i < num; i++)
    {
        if((*(ptr + i) >= 0) && (*(ptr + i + 1) < 0))
        {
            count = count + 1;

        }
        else if((*(ptr + i) < 0) && (*(ptr + i + 1) >= 0))
        {
            count = count + 1;

        }
    }

    return count;
}



//4.	Function to determine and display the results
void determine_result(int num_of_crossings)
{
    //If statement used to determine if the file was a No file.
        if(num_of_crossings <= 900)
        {
             printf("Yes File/n");
        }

        //Else if statement used to determine if the file was a Yes file.
        else if(num_of_crossings >900)
        {
             printf("Yes File/n");
        }


}





